<template>
    <div>
        <h3>学生列表</h3>
        <table>
            <thead>
                <tr>
                    <th>学生编号</th>
                    <th>学生姓名</th>
                    <th>学生年龄</th>
                    <th>学生操作</th>
                </tr>
            </thead>
            <tbody>
                <tr v-for="item in studentData" :key="item.id">
                    <td>{{ item.id }}</td>
                    <td>{{ item.name }}</td>
                    <td>{{ item.age }}</td>
                    <td>
                        <button @click="$emit('onDeleteStudent', item.id)">删除</button>
                        <button @click="$emit('onGetUpdateStudent', item)">修改</button>
                    </td>
                </tr>
            </tbody>
        </table>
    </div>
</template>

<script setup>
defineProps({
    studentData: {
        type: Array,
        default() {
            return []
        }
    }
})
</script>

<style scoped></style>